package com.example.test.dialogfactory;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.google.vr.sdk.widgets.pano.VrPanoramaEventListener;
import com.google.vr.sdk.widgets.pano.VrPanoramaView;
import com.google.vr.sdk.widgets.pano.VrPanoramaView.Options;
import java.io.IOException;
import java.io.InputStream;

public class MainActivity92 extends AppCompatActivity {

    private VrPanoramaView mVrPanoramaView;
    private Options mOptions;

    public static void start( Context context ) {

        Intent starter = new Intent( context, MainActivity92.class );
        context.startActivity( starter );
    }

    @Override
    protected void onCreate( Bundle savedInstanceState ) {

        super.onCreate( savedInstanceState );
        setContentView( R.layout.activity_main92 );
        initView();
    }

    private void initView() {

        mVrPanoramaView = (VrPanoramaView) findViewById( R.id.vrPanoramaView );

        mVrPanoramaView.setTouchTrackingEnabled( true );
        mVrPanoramaView.setFullscreenButtonEnabled( true );
        mVrPanoramaView.setInfoButtonEnabled( false );
        mVrPanoramaView.setStereoModeButtonEnabled( false );
        mVrPanoramaView.setEventListener( new VrEventListener() );
        mOptions = new Options();
        mOptions.inputType = Options.TYPE_MONO;

        try {
            InputStream stream = getAssets().open( "beijing_gugong.jpg" );
            Bitmap bitmap = BitmapFactory.decodeStream( stream );
            mVrPanoramaView.loadImageFromBitmap( bitmap, mOptions );
        } catch ( IOException e ) {
            e.printStackTrace();
        }
    }

    private static class VrEventListener extends VrPanoramaEventListener {

        @Override
        public void onClick() {

        }
    }
}